<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f4f4f4;
        }

        .login-container {
            text-align: center;
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 300px;
        }

        .input-group {
            display: flex;
            justify-content: center;
            margin-bottom: 10px;
        }

        .input-group label {
            margin-right: 10px;
            width: 50px;
            text-align: right;
        }

        .input-group input {
            width: 150px;
            padding: 5px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        .login-button {
            padding: 5px 10px;
            border: none;
            background-color: rgba(0, 0, 0, 0.5); /* 半透明背景 */
            color: white;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        .login-button:hover {
            background-color: rgba(0, 0, 0, 0.7); /* 鼠标悬停时加深透明度 */
        }
    </style>
</head>
<body>
    <div class="login-container">
        <h1>用户登录</h1>
        <div class="input-group">
            <label for="username">用户名:</label>
            <input type="text" id="username" placeholder="请输入用户名">
        </div>
        <div class="input-group">
            <label for="password">密码:</label>
            <input type="password" id="password" placeholder="请输入密码">
        </div>
        <button class="login-button" onclick="handleLogin()">登录</button>
    </div>

    <script>
        function handleLogin() {
            const username = document.getElementById('username').value;
            const password = document.getElementById('password').value;

            if (username && password) {
                alert(`登录成功！用户名：${username}`);
            } else {
                alert('请输入用户名和密码！');
            }
        }
    </script>
</body>
</html>
